//
//  BuresResultViewController.m
//  ZiJinLian
//
//  Created by 🐛 on 2017/4/10.
//  Copyright © 2017年 lzy. All rights reserved.
//

#import "BuresResultViewController.h"
#import "AllOrderViewController.h"
@interface BuresResultViewController ()

@end

@implementation BuresResultViewController
-(void)viewWillAppear:(BOOL)animated{
    [super viewWillAppear:YES];
    //self.navigationController.navigationBar.hidden=YES;
}
- (void)viewDidLoad {
    [super viewDidLoad];
    self.title=MyString(@"支付结果");
    //[self SucceedView];
    [self FailView];
    // Do any additional setup after loading the view.
}
//成功页面
-(void)SucceedView{
    UIView *view=[[UIView alloc]initWithFrame:CGRectMake(0, 0, MainW, MainH)];
    view.backgroundColor=[UIColor whiteColor];
    [self.view addSubview:view];
    UIImageView*headImg=[[UIImageView alloc]init];
    headImg.image=[UIImage imageNamed:@"img_success_monk"];
    [view addSubview:headImg];
    [headImg mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.equalTo(100);
        make.centerX.equalTo(view.mas_centerX);
        make.width.equalTo(180);
        make.height.equalTo(210);
    }];
    MYLabel *label=[[MYLabel alloc]init];
    if (self.stype==2) {
        label.text=MyString(@"提现成功");
    }else{
        label.text=MyString(@"充值成功");
    }
    
    label.textColor=button_Red_Color;
    label.textAlignment=1;
    [view addSubview:label];
    [label mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.equalTo(headImg.mas_bottom).offset(20);
        make.right.equalTo(0);
        make.width.equalTo(MainW);
        make.height.equalTo(20);
    }];
    UIButton *button=[[UIButton alloc]init];
    [button setTitle:MyString(@"完成") forState:UIControlStateNormal];
    [button setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal];
    [button addTarget:self action:@selector(FinishClick:) forControlEvents:UIControlEventTouchUpInside];
    [button setBackgroundColor:HJ_Color(205, 8, 20)];
    [view addSubview:button];
    [button mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.equalTo(label.mas_bottom).offset(20);
        make.right.equalTo(-10);
        make.width.equalTo(MainW-20);
        make.height.equalTo(50);
    }];
    ViewRadius(button, 5);
    
    
}
//失败页面
-(void)FailView{
    UIView *view=[[UIView alloc]initWithFrame:CGRectMake(0, 0, MainW, MainH)];
    view.backgroundColor=[UIColor whiteColor];
    [self.view addSubview:view];
    UIImageView*headImg=[[UIImageView alloc]init];
    headImg.image=[UIImage imageNamed:@"img_fail_monk"];
    [view addSubview:headImg];
    [headImg mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.equalTo(100);
        make.centerX.equalTo(view.mas_centerX);
        make.width.equalTo(180);
        make.height.equalTo(210);
    }];
    MYLabel *label=[[MYLabel alloc]init];
    label.textColor=HJ_Color(227, 83, 29);
    label.textAlignment=1;
    [view addSubview:label];
    [label mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.equalTo(headImg.mas_bottom).offset(20);
        make.right.equalTo(0);
        make.width.equalTo(MainW);
        make.height.equalTo(20);
    }];
    UIButton *button=[[UIButton alloc]init];
    [button setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal];
    [button addTarget:self action:@selector(FinishClick:) forControlEvents:UIControlEventTouchUpInside];
    [button setBackgroundColor:HJ_Color(227, 83, 29)];
    [view addSubview:button];
    [button mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.equalTo(label.mas_bottom).offset(20);
        make.right.equalTo(-10);
        make.width.equalTo(MainW-20);
        make.height.equalTo(50);
    }];
    ViewRadius(button, 5);
    if (self.stype==2) {
        [button setTitle:MyString(@"重新提现") forState:UIControlStateNormal];
        label.text=MyString(@"提现失败");
    }else{
        label.text=MyString(@"充值失败");
        [button setTitle:MyString(@"重新充值") forState:UIControlStateNormal];
    }

}
-(void)FinishClick:(UIButton *)sender{
    AllOrderViewController *vc=[[AllOrderViewController alloc]init];
    [self.navigationController pushViewController:vc animated:YES];
}
@end
